package com.wade.controller;

import com.wade.pojo.User;
import com.wade.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    @ResponseBody
    public User login(User user) {
        User user1 = userService.login(user);
        return user1;
    }

    @RequestMapping(value = "signUp", method = RequestMethod.POST)
    @ResponseBody
    public String signUp(User user) {
        userService.signUp(user);
        return "注册成功";
    }
}
